home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / progs / prelude / PreludeIOPrims.hi < prev    next >
Encoding:
Text File  |  1994-09-27  |  3.7 KB  |  131 lines  |  [TEXT/YHS2]

  1. interface PreludeBltinIO where
  2.  
  3. import PreludeMonadicIO(
  4.   IO(..), IOError, IOResult_, Handle,
  5.   HandleKind, OpenClosed, BufferMode, IOMode)
  6. infixr 1 >>, >>=
  7.  
  8. {-# Prelude #-}
  9.  
  10.  
  11. -- IO Monad primitives.
  12. -- applyIO is used internally by the system.
  13.  
  14. failwith     :: IOError -> IO a
  15. try          :: IO a -> (IOError -> IO a) -> IO a
  16. (>>=)        :: IO a -> (a -> IO b) -> IO b
  17. (>>)         :: IO a -> IO b -> IO b
  18. applyIO      :: IOResult_ a -> (a -> IOResult_ b) -> IOResult_ b 
  19. showError    :: IOError -> String
  20.  
  21. {-#
  22. failwith     :: LispName("prim.failwith"),
  23.                 Strictness("S"), NoConversion
  24. try          :: LispName("prim.try"),
  25.                 Strictness("S,N"), NoConversion
  26. (>>=)        :: LispName("prim.thenio"),
  27.                 Strictness("S,N"), NoConversion
  28. (>>)         :: LispName("prim.seqio"),
  29.                 Strictness("S,N"), NoConversion
  30. applyIO      :: LispName("prim.applyio"),
  31.                 Strictness("S,N"), NoConversion
  32. showError    :: LispName("prim.show-error"), Strictness("S")
  33. #-}
  34.  
  35.  
  36. -- Handle operations
  37.  
  38. showHandle   :: Handle -> String
  39. stdin        :: Handle
  40. stdout       :: Handle
  41. stderr       :: Handle
  42. stdnull      :: Handle
  43. openFile     :: IOMode -> String -> IO Handle
  44. openChan     :: String -> IO Handle
  45. flush        :: Handle -> IO ()
  46. close        :: Handle -> IO ()
  47. hName        :: Handle -> IO String
  48. hKind        :: Handle -> IO HandleKind
  49. hOpen        :: Handle -> IO OpenClosed
  50. hFile        :: Handle -> IO Bool
  51. hBuff        :: Handle -> IO BufferMode
  52. hEcho        :: Handle -> IO Bool
  53. hSize        :: Handle -> IO Integer
  54. hPosn        :: Handle -> IO Integer
  55. seek         :: Handle -> Integer -> IO ()
  56. setBuffering :: Handle -> BufferMode -> IO ()
  57. setEchoing   :: Handle -> Bool -> IO ()
  58.  
  59. {-#
  60. showHandle   :: LispName("prim.show-handle")
  61. stdin        :: LispName("prim.stdin")
  62. stdout       :: LispName("prim.stdout")
  63. stderr       :: LispName("prim.stderr")
  64. stdnull      :: LispName("prim.stdnull")
  65. openFile     :: LispName("prim.open-file")
  66. openChan     :: LispName("prim.open-chan")
  67. flush        :: LispName("prim.flush")
  68. close        :: LispName("prim.close")
  69. hName        :: LispName("prim.handle-name")
  70. hKind        :: LispName("prim.handle-kind")
  71. hOpen        :: LispName("prim.handle-open")
  72. hFile        :: LispName("prim.handle-file")
  73. hBuff        :: LispName("prim.handle-buff")
  74. hEcho        :: LispName("prim.handle-echo")
  75. hSize        :: LispName("prim.handle-size")
  76. hPosn        :: LispName("prim.handle-posn")
  77. seek         :: LispName("prim.seek")
  78. setBuffering :: LispName("prim.set-buffering")
  79. setEchoing   :: LispName("prim.set-echoing")
  80. #-}
  81.  
  82.  
  83. -- input operations
  84.  
  85. ready        :: Handle -> IO Bool
  86. hGetChar     :: Handle -> IO Char
  87. getContents  :: Handle -> IO String
  88.  
  89. {-#
  90. ready        :: LispName("prim.ready")
  91. hGetChar     :: LispName("prim.get-char")
  92. getContents  :: LispName("prim.get-contents"), NoConversion
  93. #-}
  94.  
  95.  
  96. -- output operations
  97.  
  98. hPutChar     :: Handle -> Char -> IO ()
  99.  
  100. {-#
  101. hPutChar     :: LispName("prim.put-char")
  102. #-}
  103.  
  104.  
  105. -- Operating system interaction
  106.  
  107. deleteFile   :: String -> IO ()
  108. statusFile   :: String -> IO String
  109. getArgs      :: IO [String]
  110. getProgName  :: IO String
  111. getEnv       :: String -> IO String
  112. setEnv       :: String -> String -> IO ()
  113. getClock     :: IO Integer
  114. getCpuTime   :: IO Integer
  115. process      :: String -> Handle -> Handle -> Handle -> IO ()
  116. system       :: String -> IO String
  117.  
  118.  
  119. {-#
  120. deleteFile   :: LispName("prim.delete-file")
  121. statusFile   :: LispName("prim.status-file")
  122. getArgs      :: LispName("prim.getargs")
  123. getProgName  :: LispName("prim.getprogname")
  124. getEnv       :: LispName("prim.getenv")
  125. setEnv       :: LispName("prim.setenv")
  126. getClock     :: LispName("prim.getclock")
  127. getCpuTime   :: LispName("prim.getcputime")
  128. process      :: LispName("prim.run-process")
  129. system       :: LispName("prim.system")
  130. #-}
  131.